﻿<UserControl x:Class="SkypeStudio.Controls.Views.ChatList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
               xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
              xmlns:f="clr-namespace:SkypeStudio.Framework;assembly=SkypeStudio.Framework" 
                xmlns:c="clr-namespace:SkypeStudio.Controls.Converters"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <ListView x:Name="listView"  ItemsSource="{Binding Chats}"  SelectedItem="{Binding SelectedChat, Mode=TwoWay}">
            <!--<i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <f:EventToCommand Command="{Binding ListMouseDoubleClickCommand}"  PassEventArgsToCommand="False"  
                                      CommandParameter="{Binding SelectedChat}"  />
                </i:EventTrigger>
            </i:Interaction.Triggers>-->
            <!--<ListView.InputBindings>
                <MouseBinding   MouseAction="LeftDoubleClick" Command="{Binding ListMouseDoubleClickCommand}" />
            </ListView.InputBindings>-->
            <ListView.ItemTemplate>
                <DataTemplate >
                    <!--Border BorderThickness="2" BorderBrush="Red">-->
                    <!--<Border.InputBindings>
                            <MouseBinding   Gesture="LeftDoubleClick" Command="{Binding DataContext.ListMouseDoubleClickCommand, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}" />
                        </Border.InputBindings>-->

                    <Grid Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ListView, AncestorLevel=1}, Path=ActualWidth}">
                        <Grid.InputBindings>
                            <MouseBinding   Gesture="LeftDoubleClick" Command="{Binding DataContext.ListMouseDoubleClickCommand, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}" />
                        </Grid.InputBindings>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" x:Name="imgStatus" Width="25" Height="25"   Margin="5"
                               Source="{Binding OnlineStatus, Converter={x:Static c:OnlineStatuImageConvertor.Default}}"/>

                        <TextBlock Grid.Row="0" Grid.Column="1"  x:Name="txtContactName" Text="{Binding MembersName}" FontWeight="Bold" />
                        <TextBlock  Grid.Row="1" Grid.Column="1"   x:Name="txtLastMessage" Text="{Binding LastChatMessage}"  Foreground="Gray" TextWrapping="Wrap"/>
                    </Grid>
                    <!--<StackPanel  Orientation="Horizontal" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ListView, AncestorLevel=1}, Path=ActualWidth}">-->
                    <!--<StackPanel.InputBindings>
                                <MouseBinding   Gesture="LeftDoubleClick" Command="{Binding DataContext.ListMouseDoubleClickCommand, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}" />
                            </StackPanel.InputBindings>-->
                    <!--<Image Width="25" Height="25" Source="{Binding AvatarImage}"/>-->

                    <!--<StackPanel Orientation="Vertical">
                                
                            </StackPanel>-->

                    <!--</StackPanel>-->
                    <!--</Border>-->
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </Grid>
</UserControl>
